package com.songjiasong.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBConnection extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "NoteBookDB";
	private static final int DATABASE_VERSION = 1;
	public DBConnection(Context ctx) {
		super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "CREATE TABLE " + NoteBookSchema.TABLE_NAME + " (" 
		+ NoteBookSchema.ID  + " INTEGER primary key autoincrement, " 
		+ NoteBookSchema.DATE + " text not null, " 
		+ NoteBookSchema.TITLE + " text not null, " 
		+ NoteBookSchema.CONTENT + " text not null"+ ");";
		db.execSQL(sql);	
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub	
	}

}
